home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / btrieve / bs301.com / BSEARCH.DOC next >
Text File  |  1990-02-14  |  6KB  |  168 lines

  1. BSEARCH.EXE
  2. Copyright (C) David Harris, 1988
  3.  
  4. BSearch v3.01 w/CRC
  5.  
  6. Usage:
  7.         BSEARCH [<file_spec> [-<opt> [-<opt>...]]] 
  8.  
  9. Options:
  10.         -D Delete files found
  11.         -X Delete files regardless of attributes
  12.         or:
  13.         -V<file_name> Virus check to file
  14.         -A<file_name> Append file change info to file
  15.         -F<file_name> Write file change info to file
  16.         -U Update when checksums differ
  17.         or:
  18.         -? or -H This message
  19.  
  20.         / may be used in place of -
  21.  
  22. A recent article I read (sorry, can't remember where) spoke of viruses
  23. and how they could be prevented.  It said the only sure-fire way was to
  24. keep track of file sizes and CRC's for any file which is executable or 
  25. overlayable.  Such files on DOS machines would be: COM, EXE, SYS, OVL,
  26. and any other files which are binary executable.  This makes sense,
  27. if you realize a virus must run to spread.
  28.  
  29. Current products on the market either stay resident in memory and
  30. watch for suspicious activity, or they look for specific "signatures"
  31. of previously found viruses.  I personnally hate loading too many
  32. TSR's in memory and I don't want to be the "lucky" fellow who happens
  33. on some new virus.  Also, many current products that perform
  34. checksumming only keep track of one checksum per file.
  35.  
  36. So, I wrote BSEARCH.  The name stands for Binary SEARCH and stems
  37. from the fact that the database of CRC's is a B-Tree (Binary Tree)
  38. database.  BSEARCH also has a few utilitarian uses as well.  In
  39. addition to virus watching, it can be used to find files on a hard
  40. disk and, optionally, to delete thos files when it finds them.  A
  41. 16-bit and a 32-bit CRC are used when checking for viruses.
  42.  
  43. In it's simplest form, bsearch will search for and list all files in
  44. the current and any sub-directories. Simply type:
  45.  
  46.    BSEARCH<cr>
  47.  
  48. <cr> means hit the Carriage Return (yes, the Enter Key)
  49.  
  50. To search for specific files type:
  51.  
  52.    BSEARCH ab*.c?d
  53.  
  54. This will search for all files that begin with 'ab' and have a 'c' and
  55. 'd' in their respective places in the current AND sub-directories.
  56.  
  57. To specify a particular place to search from, type:
  58.  
  59.    BSEARCH d:\*.exe
  60.  
  61. This will search ALL of drive d: for files having the .EXE extension.
  62.  
  63. To track the CRC's of all .EXE files on drive c:, type:
  64.  
  65.    BSEARCH c:\*.exe -vc:\v\exe
  66.  
  67. this would store all filenames (with paths) and their file sizes and
  68. CRC's into a file named EXE.db & EXE.idx in the c:\v directory. The first
  69. time you run this, the index and database is created and the file
  70. information is stored.  Only on consecutive runs will you be able to
  71. determine an infection.  Basically, you will receive a message
  72. alerting you to the fact that a file size or CRC has been changed.
  73.  
  74. The best way to run BSEARCH is to set a batch file that can be run
  75. on a continual basis.  The followin:
  76.  
  77.    BSEARCH c:\*.com -vc:\v\comfiles -ac:\v\bsearch.log 
  78.  
  79. would track file information on all .COM files on drive c: by storing
  80. that information in a database named COMFILES on directory \v of
  81. drive c: and would also report any problems to a file named
  82. bsearch.log, appending to the file.  If -f were used in place of -a,
  83. the previous bsearch.log file, if any, would be overwritten.  The
  84. only other option that may help here is -u, which would automatically
  85. update the file information if it changed.  Following is a sample
  86. batch file:
  87.  
  88. bsearch c:\*.com -vc:\v\com -ac:\v\vcheck.log %1
  89. bsearch c:\*.exe -vc:\v\exe -ac:\v\vcheck.log %1
  90. bsearch c:\*.ovl -vc:\v\ovl -ac:\v\vcheck.log %1
  91. bsearch c:\*.sys -vc:\v\sys -ac:\v\vcheck.log %1
  92.  
  93. If this batch file were named vcheck.bat, you would run it by typing:
  94.  
  95.    VCHECK
  96.  
  97. The %1 at the end of each line would duplicate the first option you
  98. might type on the command line.  For example:
  99.  
  100.    VCHECK -u
  101.  
  102. Would have BSEARCH update any file changes in the database and would
  103. be useful if, after reading your report, you decided the changes were
  104. not virus infections (maybe you're a programmer and you recompiled a
  105. file) and wanted the database to reflect the current information.
  106.  
  107. Examples:
  108.  
  109. To update all .exe file info, type:
  110.  
  111.    bsearch c:\*.exe -vc:\v\exe -u
  112.  
  113. to update all wp.exe file info in all directories starting with \wp:
  114.  
  115.    bsearch c:\wp\wp.exe -vc:\v\exe -u
  116.  
  117. Normally, information is written to the screen only.  To also write
  118. changes to a text file, use:
  119.  
  120.    bsearch c:\*.exe -vc:\v\exe -fc:\logfile -u
  121.  
  122. OTHER USES FOR BSEARCH
  123.  
  124. Because BSEARCH is so quick at climbing directory trees, I added some
  125. additional functions.  First, as I have already described, BSEARCH is
  126. a handy file finder.  Just entering the filespec and nothing else
  127. will display file information for all files meeting that filespec. 
  128. For example:
  129.  
  130.    BSEARCH d:\WP\*.DOC
  131.  
  132. would list all files in d:\wp that end with .DOC
  133.  
  134. Additionally, BSEARCH can be used to delete the files it finds.  Just
  135. type:
  136.  
  137.    BSEARCH d:\*.bak -d
  138.  
  139. To delete all .BAK files off drive D:  This method will only delete
  140. files NOT marked READ-ONLY, HIDDEN, or SYSTEM.  To delete those files
  141. also, use -x instead of -d, for example:
  142.  
  143.    BSEARCH c:\*.sys -x
  144.  
  145. would delete all .SYS files off drive C:, including the DOS system
  146. files located in the root directory.
  147.  
  148. Both delete options will prompt you before continuing, just in case
  149. you didn't mean to use a delete option.
  150.  
  151.  
  152.  
  153. BSEARCH is NOT PUBLIC DOMAIN, but may be distributed and used FREE OF CHARGE.
  154. BSEARCH may not be distributed with any commercial products without my prior,
  155. written consent.
  156.  
  157. If you find BSearch of value, a contribution of $10 would be helpful.
  158.  
  159. Comments, complaints, suggestions may be sent to Compuserve E-Mail:
  160.  
  161.    ID# 76060,3233
  162.  
  163. or Snail Mail:
  164.  
  165.    David Harris
  166.    P. O. Box 2058
  167.    El Paso, TX  79951
  168.